package cn.stronglink.esm27.collection.iot.devices.esm27.task;

import java.util.TimerTask;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import cn.stronglink.esm27.collection.iot.devices.esm27.ESM27Server;

public class PushWindTimer extends TimerTask {
	private static Logger logger = LogManager.getLogger(PushGasTimer.class.getName());
	private ESM27Server esm27Server; // esm27服务器
	
	public PushWindTimer(ESM27Server server) {
		this.esm27Server=server;
	}

	@Override
	public void run() {
		try {
			if (esm27Server.isConnection()) {
				byte[] datas = new byte[] {(byte)0xFF, 0x05, 0x00, 0x42, (byte)0xA0};
				esm27Server.send(datas);
				logger.info("定时获取风向实时数据命令已发送");
			}
		} catch (Exception e) {
			logger.error(e);
		}
	}
}
